from http.cookies import SimpleCookie

from aiohttp.abc import AbstractCookieJar


def cookiejar_to_string_list(cookie_jar: AbstractCookieJar) -> list[str]:
    cookie_strings = []
    for cookie in cookie_jar:
        # 将 Cookie 对象转为 Set-Cookie 格式的字符串
        cookie_strings.append(str(cookie))
    return cookie_strings

def string_list_to_simple_cookie(s: list[str]) -> SimpleCookie:
    cookie = SimpleCookie()
    for i in s:
        cookie.load(i[12:])
    return cookie